package com.example.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSON;
import com.example.pojo.City;
import com.example.pojo.Country;
import com.example.pojo.Provice;
import com.example.service.SanJiLianDongService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/SanJiLianDongController")
public class SanJiLianDongController {
@Reference
    SanJiLianDongService sanJiLianDongService;
@RequestMapping("/getCity")
    public String  getCity(String id){

    List<City> cities = sanJiLianDongService.findCityById(id);
        return JSON.toJSONString(cities);
    }


    @RequestMapping("/getPro")
    public String  getPro(){

        List<Provice> provice= sanJiLianDongService.findProvice();
        return JSON.toJSONString(provice);
    }
    @RequestMapping("/getCountry")
    public String getCounrty(String id){

        List<Country> countries = sanJiLianDongService.findCountryById(id);
        return JSON.toJSONString(countries);
    }



}
